
#include "main.h"

#define   INSTALLER_PASSWORD_TIMEOUT	40
#define   INSTALLER_PASSWORD_SIZE		9

INSTALLER_CONFIG Installer_Config = 0; 

static unsigned char Timer = 0;

//const unsigned char InstallerPassword[] = "100200300";

static unsigned char Buffer[INSTALLER_PASSWORD_SIZE+1];
static unsigned char pBuffer = 0; 


void Installer_Login ( void )
{
	if ( PressedKey )
	{
		//BEEP();
		Timer = INSTALLER_PASSWORD_TIMEOUT;
		Buffer[pBuffer] = PressedKey;
		if ( ++pBuffer == INSTALLER_PASSWORD_SIZE )
		{				
			Buffer[pBuffer] = 0;
			pBuffer = 0;
			//if ( StrCmp(InstallerPassword, Buffer ) == 0 )
			if ( E2_StrCmp( Buffer, E2_ADDR_PASSWORD_INSTALLER ) == 0 )
			{
				//lcd_print_str("INSTALLER", 3, 2, 1);
				//delay_ms(2000);	
				SysState = MENU;
				CurrentMenu = &Installer_Main_Menu;
			}
		}
	} 
	else
		if ( Buffer[0] != 0 && Time_10ms && --Timer == 0 )
		{
			pBuffer = 0;
			ClearBuffer(Buffer, INSTALLER_PASSWORD_SIZE+1);
		}
} 
